package com.zsx.shopping.ware.mapper;

import com.zsx.shopping.common.api.ware.vo.SkuStockVO;
import com.zsx.shopping.ware.entity.WareSkuStock;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Entity com.zsx.shopping.ware.entity.WareSkuStock
 */
public interface WareSkuStockMapper extends BaseMapper<WareSkuStock> {

    @MapKey("skuId")
    Map<Long, SkuStockVO> getSkuStockBySkuIds(@Param("skuIds") List<Long> skuIds);

    int releaseStock(@Param("orderId") Long orderId);

    List<Long> getWareIdsHasStock(@Param("skuId") Long skuId, @Param("num") Integer num);

    int lockStock(@Param("skuId") Long skuId, @Param("num") Integer num, @Param("wareId") Long wareId);

    int reduceStock(@Param("orderId") Long orderId);
}




